<template>
  <div class="common-layout">
    <el-container>
      <el-header>
        <el-menu
          :default-active="activeIndex"
          class="el-menu-demo"
          router
          mode="horizontal"
          :ellipsis="false"
          @select="handleSelect"
        >
          <el-menu-item index="0">
            <img
              style="width: 100%; height: 100%"
              src="../../assets/lo.png"
              alt="Element logo"
            />
          </el-menu-item>
          <el-menu-item index="/about">首页</el-menu-item>
          <el-sub-menu index="2">
            <template #title>Workspace</template>
            <el-menu-item index="/abo">申请</el-menu-item>
            <el-menu-item index="2-2">item two</el-menu-item>
            <el-menu-item index="2-3">item three</el-menu-item>
            <el-sub-menu index="2-4">
              <template #title>item four</template>
              <el-menu-item index="2-4-1">item one</el-menu-item>
              <el-menu-item index="2-4-2">item two</el-menu-item>
              <el-menu-item index="2-4-3">item three</el-menu-item>
            </el-sub-menu>
          </el-sub-menu>
          <el-menu-item index="/my">
            <el-avatar :size="45" :src="circleUrl" />
          </el-menu-item>
        </el-menu>
      </el-header>
      <el-container>
        <el-aside>
          <el-menu
            default-active="2"
            active-text-color="#ffd04b"
            background-color="#545c64"
            text-color="#fff"
            router
            class="el-menu-vertical-demo"
            @open="handleOpen"
            @close="handleClose"
          >
            <el-menu-item index="/about">
              <el-icon><location /></el-icon>
              <span>首页</span>
            </el-menu-item>
            <el-menu-item index="/abo">
              <el-icon><icon-menu /></el-icon>
              <span>申请</span>
            </el-menu-item>
            <el-menu-item index="/hola">
              <el-icon><document /></el-icon>
              <span>管理</span>
            </el-menu-item>
            <el-sub-menu index="2">
              <template #title>Workspace</template>
              <el-menu-item index="2-1">管理</el-menu-item>
              <el-menu-item index="2-3">item three</el-menu-item>
              <el-sub-menu index="2-4">
                <template #title>item four</template>
                <el-menu-item index="2-4-1">item one</el-menu-item>
                <el-menu-item index="2-4-2">item two</el-menu-item>
                <el-menu-item index="2-4-3">item three</el-menu-item>
              </el-sub-menu>
            </el-sub-menu>
            <el-menu-item index="/my">
              <el-icon><setting /></el-icon>
              <span>个人中心</span>
            </el-menu-item>
          </el-menu>
        </el-aside>
        <el-main>
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script setup>
import { RouterView } from "vue-router";
import {
  Document,
  Menu as IconMenu,
  Location,
  Setting,
} from "@element-plus/icons-vue";
import { reactive, toRefs } from "vue";

const state = reactive({
  circleUrl: "../../../public/tx.png",
});

const { circleUrl, squareUrl, sizeList } = toRefs(state);
</script>

<style lang="scss" scoped>
.common-layout {
  .el-menu-vertical-demo {
    height: 100%;
  }
  .el-menu--horizontal > .el-menu-item:nth-child(1) {
    margin-right: auto;
  }
  .el-menu-item {
    text-align: center;
  }
}
</style>
